locals {
  eip_groups = {
    eip_ecs_devops-dev = {
      bandwidth_name = "eip_ecs_devops-dev"
      share_type     = "PER"
      size           = "1"
      charge_mode    = "traffic"
    }
    eip_nat_gateway = {
      bandwidth_name = "eip_nat_gw_superhub-dev"
      share_type     = "PER"
      size           = "1"
      charge_mode    = "traffic"
    }
    eip_elb_web = {
      bandwidth_name = "eip_elb_superhub_web-dev"
      share_type     = "PER"
      size           = "1"
      charge_mode    = "traffic"
    }
    eip_elb_im = {
      bandwidth_name = "eip_elb_superhub_im-dev"
      share_type     = "PER"
      size           = "1"
      charge_mode    = "traffic"
    }
  }
}

resource "huaweicloud_vpc_eip" "mod_eip" {
  for_each = local.eip_groups
  publicip {
    type = "5_bgp"
  }
  bandwidth {
    name        = each.value.bandwidth_name
    share_type  = each.value.share_type
    size        = each.value.size
    charge_mode = each.value.charge_mode
  }
}